<template>
  <div class="collection-container">
    <section class="content">
      <h1>藏品信息</h1>
      <h2>Collection</h2>
      <div class="collection-grid">
        <el-card 
          v-for="(item, index) in collectionItems" 
          :key="index" 
          class="collection-item"
          :body-style="{ padding: '0px' }">
          <img :src="item.image" class="collection-image" alt="藏品图片">
          <div class="collection-content">
            <h3>{{ item.name }}</h3>
            <p>{{ item.description }}</p>
            <el-tag type="info" size="small">{{ item.era }}</el-tag>
          </div>
        </el-card>
      </div>
    </section>
    <footer class="footer">
      <p>© 2025 历史博物馆. 版权所有.</p>
      <button class="back-to-top" @click="scrollToTop" aria-label="回到页面顶部">回到顶部</button>
    </footer>
  </div>
</template>

<script>
export default {
  data() {
    return {
      collectionItems: [
        {
          name: '青铜鼎',
          description: '商代青铜鼎，用于祭祀和宴会。',
          era: '商代',
          image: require('@/assets/carousel1.jpg')
        },
        {
          name: '唐三彩',
          description: '唐代唐三彩，色彩鲜艳，造型生动。',
          era: '唐代',
          image: require('@/assets/carousel2.jpg')
        },
        {
          name: '元青花',
          description: '元代青花瓷，工艺精湛，纹饰精美。',
          era: '元代',
          image: require('@/assets/carousel3.jpg')
        },
        // 添加更多藏品
      ]
    };
  },
  methods: {
    scrollToTop() {
      window.scrollTo({
        top: 0,
        behavior: 'smooth'
      });
    }
  }
};
</script>

<style scoped>
.collection-container::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: url('@/assets/background.jpg') repeat-x center/cover;
  z-index: -1;
  opacity: 0.3;
}

.collection-container {
  position: relative;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.content {
  flex: 1;
  position: relative;
  z-index: 1;
  max-width: 1200px;
  width: 90%;
  margin: 0 auto;
  padding: 40px 20px;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(5px);
}

.content h1 {
  font-size: 30pt;
  margin-bottom: 10px;
}

.content h2 {
  font-size: 12pt;
  color: gray;
  margin: 10px 0 40px;
}

.collection-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 20px;
}

.collection-item {
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.1);
}

.collection-image {
  width: 100%;
  height: 200px;
  object-fit: cover;
}

.collection-content {
  padding: 15px;
}

.collection-content h3 {
  margin-bottom: 10px;
}

.collection-content p {
  margin-bottom: 10px;
  color: #666;
}

.footer {
  background: #333333;
  color: white;
  border-top: 2px solid #4D4D4D;
  box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.2);
  z-index: 100;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 20px;
  box-sizing: border-box;
  backdrop-filter: blur(5px);
  width: 100%;
  margin-top: auto;
}

.back-to-top {
  padding: 8px 16px;
  background: #555555;
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.3s;
  font-size: 14px;
  min-width: 100px;
}

.back-to-top:hover {
  background: #666666;
  transform: translateY(-1px);
}

@media (max-width: 768px) {
  .footer {
    flex-wrap: wrap;
    padding: 12px 10px;
    gap: 10px;
  }

  .back-to-top {
    min-width: auto;
    width: calc(50% - 10px);
  }
}
</style>